package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.clazz.ProcessTypeClass;
import java.util.ArrayList;
import java.util.List;

/**
 * 流程筛选项——流程状态 提交给我的 筛选项枚举
 * @author wufeng
 * @author 魏荣杰
 * @date 2019/1/22 15:54
 * @since v1.0
 * @version v1.0
 */
public enum ProcessSearchStatusTodoEnum {

    /**
     * 未处理
     */
    UNTREATED(TaskTypeEnum.UNTREATED.getType(), TaskTypeEnum.UNTREATED.getAlias(), "enum.processSearchStatusTodo.memo.untreated"),
    /**
     * 提交
     */
    COMMIT(TaskTypeEnum.COMMIT.getType(), TaskTypeEnum.COMMIT.getAlias(), "enum.processSearchStatusTodo.memo.commit"),

    /**
     * 转交
     */
    TRANSFER(TaskTypeEnum.TRANSFER.getType(), TaskTypeEnum.TRANSFER.getAlias(), "enum.processSearchStatusTodo.memo.transfer"),
    /**
     * 回退
     */
    BACK(TaskTypeEnum.BACK.getType(), TaskTypeEnum.BACK.getAlias(), "enum.processSearchStatusTodo.memo.back"),

    /**
     * 拒绝
     */
    END(TaskTypeEnum.END.getType(), TaskTypeEnum.END.getAlias(), "enum.processSearchStatusTodo.memo.end");

    private Integer type;

    private String alias;

    private String memo;

    ProcessSearchStatusTodoEnum(Integer type, String alias, String memo) {
        this.type = type;
        this.alias = alias;
        this.memo = memo;
    }

    public static List<ProcessTypeClass> getProcessTypeList() {
        List<ProcessTypeClass> processTypeClassList = new ArrayList<>();
        for (ProcessSearchStatusTodoEnum processSearchStatusTodoEnum : values()) {
            ProcessTypeClass processTypeClass = new ProcessTypeClass();
            processTypeClass.setType(processSearchStatusTodoEnum.getType());
            processTypeClass.setMemo(processSearchStatusTodoEnum.getMemo());
            processTypeClassList.add(processTypeClass);
        }
        return processTypeClassList;
    }

    public static String getStatusMemo(Integer taskType) {
        for (ProcessSearchStatusTodoEnum t: values()) {
            if(taskType.equals(t.getType())){
                return t.getMemo();
            }
        }
        return null;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }
}
